package com.annotation.componentScan;

import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.ComponentScans;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.FilterType;

/**
 * @author: qiuli
 * @date: 2022/1/7 17:05
 * @description:   @ComponentScan的属性 1:excludeFilters
 *                                     2:includeFilters
 *                   excludeFilters或者includeFilters的属性：@ComponentScan.Filter的属性 ANNOTATION，
 */
//@ComponentScan(value = "com.annotation.util",excludeFilters = { @ComponentScan.Filter(type = FilterType.ANNOTATION,classes = {Controller.class, Service.class})})
//@ComponentScan(value = "com.annotation.util",includeFilters = { @ComponentScan.Filter(type = FilterType.ANNOTATION,classes = {Controller.class, Service.class})},useDefaultFilters = false)
/*@ComponentScan(value = "com.annotation.util",includeFilters = {
        //这里面是一个@Filter注解数组，FilterType.ANNOTATION表示的排除的规则 ：按照注解的方式来进行匹配
        //classes = {Controller.class}表示的是标有这些注解的类给纳入到IOC容器中
        @ComponentScan.Filter(type = FilterType.ANNOTATION, classes = {Controller.class})
},useDefaultFilters = false)*/
/*
@ComponentScans(value = {
        @ComponentScan(value = "com.annotation.util",includeFilters = {
                //这里面是一个@Filter注解数组，FilterType.ANNOTATION表示的排除的规则 ：按照注解的方式来进行匹配
                //classes = {Controller.class}表示的是标有这些注解的类给纳入到IOC容器中

                // FilterType.ANNOTATION 按照注解来进行匹配
                // FilterType.ASSIGNABLE_TYPE 按照给定的类型来进行匹配
                @ComponentScan.Filter(type = FilterType.ANNOTATION, classes = {Controller.class}),
                //按照给定的类型来进行匹配e
                @ComponentScan.Filter(type = FilterType.ASSIGNABLE_TYPE, classes = {BookService.class})
        },useDefaultFilters = false)
})
*/
@Configuration
@ComponentScans(value = {
        @ComponentScan(value = "com.annotation.util",includeFilters = {
                //自定义匹配的规则
                @ComponentScan.Filter(type = FilterType.CUSTOM, classes = {MyTypeFilter.class})
        },useDefaultFilters = false)
})
public class ComponentScanFilterConfig {
}
